<?php

/**
 * This is the model class for table "tbl_preg_ges_detmo".
 *
 * The followings are the available columns in table 'tbl_preg_ges_detmo':
 * @property integer $prm_id
 * @property string $prm_codigo
 * @property string $prm_municipio
 * @property string $prm_modulos
 * @property string $prm_pregunta
 * @property string $prm_boleta
 * @property string $prm_modificacion
 * @property string $prm_nivel
 * @property integer $prm_estado
 */
class tbl_preg_ges_detmo extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return tbl_preg_ges_detmo the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_preg_ges_detmo';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('prm_codigo, prm_municipio, prm_modulos, prm_pregunta, prm_boleta, prm_modificacion, prm_nivel, prm_estado', 'required'),
			array('prm_estado', 'numerical', 'integerOnly'=>true),
			array('prm_codigo', 'length', 'max'=>8),
			array('prm_municipio, prm_modulos, prm_pregunta', 'length', 'max'=>10),
			array('prm_boleta, prm_nivel', 'length', 'max'=>6),
			array('prm_modificacion', 'length', 'max'=>150),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('prm_id, prm_codigo, prm_municipio, prm_modulos, prm_pregunta, prm_boleta, prm_modificacion, prm_nivel, prm_estado', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'prm_id' => 'Prm',
			'prm_codigo' => 'Prm Codigo',
			'prm_municipio' => 'Prm Municipio',
			'prm_modulos' => 'Prm Modulos',
			'prm_pregunta' => 'Prm Pregunta',
			'prm_boleta' => 'Prm Boleta',
			'prm_modificacion' => 'Prm Modificacion',
			'prm_nivel' => 'Prm Nivel',
			'prm_estado' => 'Prm Estado',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('prm_id',$this->prm_id);

		$criteria->compare('prm_codigo',$this->prm_codigo,true);

		$criteria->compare('prm_municipio',$this->prm_municipio,true);

		$criteria->compare('prm_modulos',$this->prm_modulos,true);

		$criteria->compare('prm_pregunta',$this->prm_pregunta,true);

		$criteria->compare('prm_boleta',$this->prm_boleta,true);

		$criteria->compare('prm_modificacion',$this->prm_modificacion,true);

		$criteria->compare('prm_nivel',$this->prm_nivel,true);

		$criteria->compare('prm_estado',$this->prm_estado);

		return new CActiveDataProvider('tbl_preg_ges_detmo', array(
			'criteria'=>$criteria,
		));
	}
}